package com.muyu.payment.domain.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.muyu.common.core.web.model.QueryModel;

import com.muyu.payment.domain.req.PaymentConfigsQueryReq;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import lombok.experimental.SuperBuilder;

import java.util.Date;

/**
 * 支付配置查询请求模型对象
 *
 * @author muyu
 * @date 2025-09-17
 */
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class PaymentConfigsQueryModel extends QueryModel<PaymentConfigsQueryModel> {

    /**
     * 支付类型(1:微信 2:支付宝 3:其他)
     */
    private Long payType;

    /**
     * 应用ID
     */
    private String appId;

    /**
     * 商户号
     */
    private String merchantId;

    /**
     * 商户私钥
     */
    private String privateKey;

    /**
     * 平台公钥
     */
    private String publicKey;

    /**
     * 支付结果回调地址
     */
    private String callbackUrl;

    /**
     * 配置名称
     */
    private String configName;

    /**
     * 是否沙箱环境(0:正式环境 1:沙箱环境)
     */
    private String isSandbox;

    /**
     * 状态(0:禁用 1:启用)
     */
    private String status;
    /**
     * 创建人
     */
    private String createBy;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "GMT+8")
    private Date createTime;

    /**
     * 修改人
     */
    private String updateBy;

    /**
     * 修改时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "GMT+8")
    private Date updateTime;
    /**
     * 查询构造器
     */
    public static PaymentConfigsQueryModel reqBuild( PaymentConfigsQueryReq queryReq){
        PaymentConfigsQueryModel paymentConfigsQueryModel = PaymentConfigsQueryModel.builder()
            .payType(queryReq.getPayType())
            .appId(queryReq.getAppId())
            .merchantId(queryReq.getMerchantId())
            .privateKey(queryReq.getPrivateKey())
            .publicKey(queryReq.getPublicKey())
            .callbackUrl(queryReq.getCallbackUrl())
            .configName(queryReq.getConfigName())
            .isSandbox(queryReq.getIsSandbox())
            .status(queryReq.getStatus())
            .createBy(queryReq.getCreateBy())
            .createTime(queryReq.getCreateTime())
            .updateBy(queryReq.getUpdateBy())
            .updateTime(queryReq.getUpdateTime())
            .build();
        paymentConfigsQueryModel.domainBuild(queryReq);
        return paymentConfigsQueryModel;
    }
}
